GtkEntryCompletion can rapidly release and claim ownership of the
primary selection. This generates multiple XFixesSelectionNotify events,
first stating that no one owns the selection, then another stating that
we own the selection. The notification that no one owns the selection
causes GtkEntryCompletion to deselect the text, breaking inline
autocompletion.
This fixes it by ignoring any XFixesSelectionNotify with a timestamp
earlier than our clipboard timestamp.
Fixes #14
if (sn->selection != cb->xselection)
return FALSE;
+ if (sn->selection_timestamp < cb->timestamp)
+ {
+ GDK_DISPLAY_NOTE (display, CLIPBOARD,
+ g_printerr ("%s: Ignoring XFixesSelectionNotify with too old timestamp (%lu vs %lu)\n",
+ cb->selection, sn->selection_timestamp, cb->timestamp));
+ return FALSE;
+ }
+
if (sn->owner == GDK_X11_DISPLAY (display)->leader_window)
{
GDK_DISPLAY_NOTE (display, CLIPBOARD,